
export async function loadFrames(videoId: number, frameCount: number): Promise<Array<ImageBitmap>> {
    const isWindows: boolean = navigator.platform === 'Windows' || navigator.platform === 'Win32'
    console.log('isWindows:', isWindows)
    const images = []
    for (let i = 1; i <= frameCount; ++i) {
        const el = document.createElement('img');
        const url = isWindows ? `https://frame.localhost/${videoId}/${i}` : `frame://localhost/${videoId}/${i}`

        let image: Promise<HTMLImageElement> = new Promise((resolve, reject) => {
            el.onload = () => resolve(el)
        })
        el.src = url

        images.push(image)
    }

    const resolved = await Promise.all(images)

    const ret = resolved.map((el) => createImageBitmap(el))

    return await Promise.all(ret)
}
